package com.zcmob.web.admanagement.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zcmob.web.admanagement.db.AppDao;
import com.zcmob.web.admanagement.vo.AdvInfo;

public class AdvListServlet extends com.zcmob.web.admanagement.servlet.ZcMobServlet {

    public AdvListServlet(){
        super();
    }
    
    @Override
    protected void handle(HttpServletRequest request, HttpServletResponse response) {
        // TODO Auto-generated method stub
        List<AdvInfo> result = AppDao.getInstance().getAdv();
        
        request.setAttribute("advlist", result);
        // 默认进入advlist页面
        request.getSession().setAttribute("channel", "advlist");
        RequestDispatcher rd = request.getRequestDispatcher("/adv_list.jsp");
        try {
            rd.forward(request, response);
        } catch (ServletException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
